package main

import (
	"context"
	"fmt"
	"github.com/kataras/iris"
	"github.com/kataras/iris/middleware/logger"
	"time"
)

func main() {
	ir := iris.New()
	ir.Use(logger.New())
	iris.RegisterOnInterrupt(func() {
		timeout := 10 * time.Minute
		ctx, cancel := context.WithTimeout(context.Background(), timeout)
		defer cancel()
		// close all hosts
		fmt.Println("show down")
		ir.Shutdown(ctx)
	})

	ir.Get("/hello", func(c iris.Context) {
		c.HTML("<h1>hello world<h1>")
	})
	ir.Run(iris.Addr(":8088"), iris.WithoutInterruptHandler)

}
